package com.ibeetl.admin.api.service;

import com.ibeetl.admin.api.dao.TravelMapPathDao;
import com.ibeetl.admin.api.entity.Travel_map_path;
import com.ibeetl.admin.core.service.CoreBaseService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
@Transactional
public class RouteService extends CoreBaseService<Travel_map_path> {
    @Resource
    private TravelMapPathDao travelMapPathDao;

    public List<Travel_map_path> queryByAttractionId(Long attraction_id) {
        return travelMapPathDao.queryByAttractionId(attraction_id);

    }

    public long queryNewIdByAttractionId(Long attractionId) {
        List<Long> list = travelMapPathDao.queryNewIdByAttractionId(attractionId);
        if(list == null || list.size()<1){
            return -1;
        }
        return list.get(0);

    }

    public void del(Long pathId,int state) {
        travelMapPathDao.updateState(pathId,state);
    }

    public void deleteByAttractionId(Long attractionId) {
        travelMapPathDao.deleteByAttractionId(attractionId);
    }
}
